﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using kegg_service;
using Excel = Microsoft.Office.Interop.Excel;
using System.Net;
using System.Xml;
using System.Runtime.InteropServices;
using System.Diagnostics;
using QuickGraph;
using System.Runtime.Serialization.Formatters.Binary;
using MySql.Data.MySqlClient;

namespace BPP
{
    public partial class controller
    {
        public class shared_functions
        {
            public static BidirectionalGraph<object, IEdge<object>> model_graph = new BidirectionalGraph<object, IEdge<object>>();
            public static BidirectionalGraph<object, IEdge<object>> constructed_graph = new BidirectionalGraph<object, IEdge<object>>();

            // Convert an object to a byte array
            public static byte[] ObjectToByteArray(Object obj)
            {
                if (obj == null)
                    return null;
                BinaryFormatter bf = new BinaryFormatter();
                MemoryStream ms = new MemoryStream();
                bf.Serialize(ms, obj);
                return ms.ToArray();
            }
            // Convert a byte array to an Object
            public static Object ByteArrayToObject(byte[] arrBytes)
            {
                MemoryStream memStream = new MemoryStream();
                BinaryFormatter binForm = new BinaryFormatter();
                memStream.Write(arrBytes, 0, arrBytes.Length);
                memStream.Seek(0, SeekOrigin.Begin);
                Object obj = (Object)binForm.Deserialize(memStream);
                return obj;
            }

         
            public static Kegg kegg = new Kegg();
            public static string _path="";
        }
    }
}
